import request from "@/utils/request";
import type { AuthorizeCode, TokenData,UserInfo,LoginData} from "../auth/userList"

class AuthAPI {

	/**
	 * 用户登陆
	 */
	static getUesrLogin(data: LoginData) {
		const formData = new FormData();
		formData.append("account", data.account);
		formData.append("pwd", data.pwd);
		return request<any, UserInfo>({
			url: "/user/login",
			method: "post",
			data: formData,
			headers: {
			},
		});
	}
	//获取环境配置
	static getServiceInfo(AuthorizeCode: string) {
		// console.log('data.invalid', data.invalid);
		return request<any>({
		  url: `/config/get_service_info`,
		  method: "get",
		//   params:formobj,
		  headers: {
			token: AuthorizeCode,
		  },
		});
	  }
	//获取数据库配置
	static getDataBase(AuthorizeCode: string) {
		// console.log('data.invalid', data.invalid);
		return request<any>({
		  url: `/config/get_database`,
		  method: "get",
		//   params:formobj,
		  headers: {
			token: AuthorizeCode,
		  },
		});
	  }
}

export default AuthAPI;
